/*
 * AutismGroupMessage.java
 *
 * Created on March 25, 2007, 12:33 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.asaga.tools;

import java.util.*;

/**
 * properties and methods for an autism group message
 * @author jeremys
 */
public class AutismGroupMessage implements Comparable<AutismGroupMessage> {
    private int messageId;
    private int groupId;
    private int personId;
    private String personName;
    private String timeCreated;
    private String messageSubject;
    private String messageBody;
    private int parentId;
    /** Creates a new instance of AutismGroupMessage */
    public AutismGroupMessage() {
    }
    //Getters
    /**
     * returns group message id
     * @return group message id
     */
    public int GetMessageId(){return this.messageId;}
    /**
     * returns the group id of the message
     * @return returns the group id of the message
     */
    public int GetGroupId(){return this.groupId;}
    /**
     * returns the id of the person who authored the message
     * @return returns the id of the person who authored the message
     */
    public int GetPersonId(){return this.personId;}
    /**
     * returns the name of the person who authored the message
     * @return returns the name of the person who authored the message
     */
    public String GetPersonName(){return this.personName;}
    /**
     * returns the time the message was created
     * @return returns the time the message was created
     */
    public String GetTimeCreated(){return this.timeCreated;}
    /**
     * returns the subject of the message
     * @return returns the subject of the message
     */
    public String GetMessageSubject(){return this.messageSubject;}
    /**
     * returns the body of the message
     * @return returns the body of the message
     */
    public String GetMessageBody(){return this.messageBody;}
    /**
     * returns the message id of the parent message
     * @return returns the message id of the parent message
     */
    public int GetPerentId(){return this.parentId;}
    
    //Setters
    /**
     * sets the message id
     * @param id message id
     */
    public void SetMessageId(int id){this.messageId=id;}
    /**
     * set the group id for the message
     * @param id group id
     */
    public void SetGroupId(int id){this.groupId=id;}
    /**
     * sets the persion id for the message
     * @param id person id
     */
    public void SetPersonId(int id){this.personId=id;}
    /**
     * sets the name of the person who authored the message
     * @param first first name
     * @param last last name
     */
    public void SetPersonName(String first, String last){
        this.personName=first+" "+last;
    }
    /**
     * sets the time that the message was created
     * @param tc time created
     */
    public void SetTimeCreated(String tc){this.timeCreated=tc;}
    /**
     * sets the subject of the message
     * @param s message subject
     */
    public void SetMessageSubject(String s){this.messageSubject=s;}
    /**
     * sets the body of the message
     * @param b message body
     */
    public void SetMessageBody(String b){this.messageBody=b;}
    /**
     * sets the message id of the parent message
     * @param id message id
     */
    public void SetParentId(int id){this.parentId=id;}
    
    
    /**
     * overrides method from super class
     * needed for object to be put into container classes
     * @param agm AutismGroupMessage
     * @return returns a signed integer to allow for comparison in container classes
     */
    public int compareTo(AutismGroupMessage agm){
        int cmp = this.parentId - agm.GetPerentId();
        if(cmp==0){
            cmp = this.messageId - agm.GetMessageId();
        }
        return cmp;
    }
}
